//
//  RHNormalCell.m
//  RuiHeAppApp
//
//  Created by Yan Chen on 2023/12/5.
//

#import "RHNormalCell.h"

@implementation RHNormalCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        [self setupUI];
    }
    return self;
}

- (void)setupUI{
    kWeakSelf;
    [self setBackgroundColor:CFTabViewBgColor];
    [self.contentView setBackgroundColor:CFTabViewBgColor];
    
    UIView *bgView = [[UIView alloc] init];
    [bgView setBackgroundColor:UIColor.whiteColor];
    [self.contentView addSubview:bgView];
    self.bgView = bgView;
    [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.insets(UIEdgeInsetsMake(0,15, 0, 15));
    }];
    
    _titleLab = [[QMUILabel alloc] init];
    [_titleLab setTextAlignment:NSTextAlignmentLeft];
    [_titleLab setFont:kSYSTEMFONT(14)];
    _titleLab.numberOfLines = 2;
    _titleLab.adjustsFontSizeToFitWidth = YES;
    _titleLab.minimumScaleFactor = 0.6;
    [_titleLab setTextColor:[UIColor colorWithHexString:@"3F4443" alpha:0.6]];
    [bgView addSubview:_titleLab];
    [_titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(15);
        make.top.mas_offset(12);
    }];
    
    
    _contentLab = [[QMUILabel alloc] init];
    [_contentLab setTextAlignment:NSTextAlignmentRight];
    [_contentLab setFont:kSYSTEMFONT(14)];
    [_contentLab setTextColor:[UIColor colorWithHexString:@"3F4443" alpha:0.8]];
    [bgView addSubview:_contentLab];
    [_contentLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_offset(-15);
        make.centerY.equalTo(weakSelf.titleLab);
        make.left.equalTo(weakSelf.titleLab.mas_right).offset(5);
    }];
    
    _snLab = [[QMUILabel alloc] init];
    [_snLab setTextAlignment:NSTextAlignmentLeft];
    _snLab.text = @"--";
    [_snLab setFont:kSYSTEMFONT(10)];
    _snLab.numberOfLines = 2;
    _snLab.adjustsFontSizeToFitWidth = YES;
    _snLab.minimumScaleFactor = 0.6;
    [_snLab setTextColor:[UIColor colorWithHexString:@"3F4443" alpha:0.8]];
    [bgView addSubview:_snLab];
    [_snLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.equalTo(weakSelf.titleLab);
        make.top.equalTo(weakSelf.titleLab.mas_bottom).offset(2);
        make.bottom.mas_offset(-8);
    }];
    
//    UIImageView *arrowImg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"arrow"]];
//    [bgView addSubview:arrowImg];
//    [arrowImg   mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.size.equalTo(@(CGSizeMake(20, 20)));
//        make.centerY.mas_offset(0);
//        make.right.mas_offset(-15);
//    }];
    UIView *line = kView;
    line.backgroundColor = CFCellLineColor;
    [bgView addSubview:line];
    [line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(15);
        make.right.mas_offset(-15);
        make.height.offset(1);
        make.bottom.mas_offset(0);
    }];
}


@end
